{layout name="layout" /}
<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading">友情链接添加</div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-sm-8">
                        <form action="{:url('admin/links/add')}" class="form-horizontal ajax-form" method="post" name="rule">
                            <div class="form-group">
                                <label for="inputname" class="col-sm-3 control-label">标题</label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control" name="title" id="inputname" placeholder="标题">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="inputurl"> 链接地址 </label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control" name="url" id="inputurl" placeholder="链接地址">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="" class="col-sm-3 control-label">LOGO</label>
                                <div class="col-sm-5">                                    
                                    <img src="{$default_image}" style="max-width:100px; max-height:100px;"  id="links_logo"  class="img-circle upload">
                                </div>
                            </div>
    
                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="inputlinker"> 联系人说明 </label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control" name="linker" id="inputlinker" placeholder="联系人说明">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="inputstatus"> 是否启用 </label>
                                <div class="col-sm-5">
                                    <input type="checkbox" name="status" id="inputstatus" value="1" />
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label" for="inputSort"> 排序 </label>
                                <div class="col-sm-5">
                                    <input type="text" class="form-control " name="sort" value="255" id="inputSort" placeholder="越小越靠前">
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <div class="col-sm-offset-3 col-sm-9">
                                    <button type="submit" class="btn btn-primary">提交</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
$(function(argument) {
    $('form.ajax-form').formLuffyZhao([{
        name: "title",
        display: '标题',
        rules: 'required'
    },{
        name: "url",
        display: '链接地址',
        rules: 'required|valid_url'
    }
    ]);

    $('.children').on('ifChecked',function (argument) {
         if(!$(this).parents('.widget-box').find('.father').is('checked')){
            $(this).parents('.widget-box').find('.father').iCheck('check');
         }
    });
});
</script>
